package ar.com.mindset.example {
	import ar.com.mindset.geometrics.ColorScheme;
	import ar.com.mindset.geometrics.MapItem;
	import ar.com.mindset.geometrics.RegionData;

	import com.degrafa.paint.BitmapFill;
	import com.degrafa.paint.ComplexFill;
	import com.degrafa.paint.SolidFill;

	import mx.collections.ArrayCollection;

	public class ImagenScheme extends ColorScheme {

		public var imagen:Object;

		public function ImagenScheme(_imagen:*=null) {
			this.imagen=_imagen;
		}

		public override function prepare(mapItem:MapItem, regionData:RegionData):void {
			if (mapItem.name == "BSAS") {
				var imageFill:BitmapFill=new BitmapFill(imagen);
				imageFill.repeatX=BitmapFill.REPEAT;
				imageFill.repeatY=BitmapFill.REPEAT;

				imageFill.smooth=true;

				var complexFill:ComplexFill=new ComplexFill([imageFill]);
				mapItem.fillcolor=imageFill;
			} else {
				var solidFill:SolidFill=new SolidFill();
				solidFill.color="#FF0000";
				mapItem.fillcolor=solidFill;
			}
		}

		public function toString():String {
			return "Image";
		}
	}
}